import {
  exportUrl,
  getLineCodeList,
  getProductProcessCodeList,
  getWorkCellCodeList,
  getWorkTeamCodeList,
  getSimulatedTypeList
} from "@/api/report/mesScanRecordDetail"
// 列表头按钮配置
export const operateList = [
  {
    name: $i18n.t("common.export"),
    type: "primary",
    icon: "el-icon-download",
    handleName: "export", //点击时返回的标识
    url: exportUrl
    //auth: "auth:operlog:export", //权限字段
  }
  // {
  //   name: "新增",
  //   type: "primary",
  //   icon: "el-icon-circle-plus-outline",
  //   handleName: "add", //点击时返回的标识
  // },
  // {
  //   name: $i18n.t("common.delete"),
  //   type: "danger",
  //   icon: "el-icon-delete",
  //   handleName: "deleteBatch", //点击时返回的标识
  // },
]
// 行末按钮配置
export const rowConfig = [
  {
    name: $i18n.t("common.edit"),
    type: "primary",
    class: "row-btn-primary",
    handleName: "edit" //点击时返回的标识
  },
  {
    name: $i18n.t("common.details"),
    type: "info",
    class: "row-btn-info",
    handleName: "detail" //点击时返回的标识
  },
  {
    name: $i18n.t("common.delete"),
    type: "danger",
    class: "row-btn-danger",
    handleName: "delete" //点击时返回的标识
  }
]
// 搜索条件配置
export const searchConfig = {
  data() {
    const _this = this
    return {
      searchDialog: {
        inline: true,
        formDesc: {
          barcode: {
            type: "input",
            label: $i18n.t("mesScanRecordDetail.barcode")
          },
          lineCode: {
            type: "select",
            label: $i18n.t("mesScanRecordDetail.productLine"),
            prop: {
              value: "modelingCode",
              text: "modelingName"
            },
            options: async (data) => {
              const params = {
                modelingCode: _this.$store.getters.factoryCode,
                level: 5
              }
              const list = await getLineCodeList(params)
              return list.data.result
            }
          },
          // lineName: {
          //   type: "input",
          //   label: "生产线体名称",
          // },
          productProcessCode: {
            type: "select",
            label: $i18n.t("mesScanRecordDetail.productProcess"),
            prop: {
              value: "processCode",
              text: "processName"
            },
            options: async (data) => {
              const list = await getProductProcessCodeList()
              return list.data.result
            }
            // on: {
            //   change: (val) => {
            //     that.handleSelectLine(val)
            //   }
            // }
          },
          // productProcessName: {
          //   type: "input",
          //   label: "生产工序名称",
          // },
          // workCellCode: {
          //   type: "select",
          //   label: "采集工位",
          //   prop: {
          //     value: "value",
          //     text: "description",
          //   },
          //   options: async (data) => {
          //     const list = await getWorkCellCodeList();
          //     return list.data.result;
          //   },
          // },
          // workCellName: {
          //   type: "input",
          //   label: "采集工位名称",
          // },
          // workTeamCode: {
          //   type: "select",
          //   label: "采集班组编码",
          //   type: 'select',
          //   prop: {
          //     value: "value",
          //     text: "description",
          //   },
          //   options: async (data) => {
          //     const list = await getWorkTeamCodeList()
          //     return list.data.result
          //   },
          // },
          // workTeamName: {
          //   type: "input",
          //   label: "采集班组名称",
          // },
          scanTime: {
            type: "datetimerange",
            label: $i18n.t("mesScanRecordDetail.scanTime"),
            attrs: {
              valueFormat: "yyyy-MM-dd HH:mm:ss",
              searchArrKey: ["scanTimeMin", "scanTimeMax"]
            }
          },
          orderCode: {
            type: "input",
            label: $i18n.t("mesScanRecordDetail.productWorkOrder")
          },
          // prodCode: {
          //   type: "input",
          //   label: "产品编码",
          // },
          prodName: {
            type: "input",
            label: $i18n.t("mesScanRecordDetail.prodName")
          },
          userCode: {
            type: "input",
            label: $i18n.t("mesScanRecordDetail.scanByJobNumber")
          },
          userName: {
            type: "input",
            label: $i18n.t("mesScanRecordDetail.userName")
          }
          // seriesCode: {
          //   type: "input",
          //   label: "系列编码",
          // },
          // seriesName: {
          //   type: "input",
          //   label: "系列名称",
          // },
          // simulatedType: {
          //   type: "select",
          //   label: "虚实订单类型",
          //   type: 'select',
          //   prop: {
          //     value: "value",
          //     text: "description",
          //   },
          //   options: async (data) => {
          //     const list = await getSimulatedTypeList()
          //     return list.data.result
          //   },
          // },
          // prodOrderType: {
          //   type: "select",
          //   label: "生产订单类型",
          //   type: 'select',
          //   prop: {
          //     value: "value",
          //     text: "description",
          //   },
          //   options: async (data) => {
          //     const list = await getProdOrderTypeList()
          //     return list.data.result
          //   },
          // },
        }
      }
    }
  }
}
